<link rel="stylesheet" href="__CDN__/assets/kindeditor/themes/default/default.css" />
<script src="__CDN__/assets/kindeditor/kindeditor.js"></script>
<script src="__CDN__/assets/kindeditor/lang/zh_CN.js"></script>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label for="c-ad_title" class="control-label col-xs-12 col-sm-2">{:__('Ad_title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-ad_title" data-rule="required" class="form-control" name="ad_title" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-picture" class="control-label col-xs-12 col-sm-2">{:__('Picture')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-picture" class="form-control" size="50" name="picture" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-picture" class="btn btn-danger plupload" data-input-id="c-picture" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-picture"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-picture" class="btn btn-primary fachoose" data-input-id="c-picture" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-picture"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-picture"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea style="width:100%;height:400px" name="auto_content"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="c-source" class="control-label col-xs-12 col-sm-2">{:__('Source')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-source" class="form-control" name="source" type="text">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">提交</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('textarea[name="auto_content"]', {
            allowFileManager : true,
            resizeType:0,
            //autoHeightMode : true,
            afterCreate : function() {
                this.sync();
                this.loadPlugin('autoheight');
            },
            afterChange: function(){ //编辑器内容发生变化后，将编辑器的内容设置到原来的textarea控件里
                this.sync();
            },
            afterBlur : function(){ //编辑器聚焦后，将编辑器的内容设置到原来的textarea控件里
                this.sync();
            }
        });
    });
</script>
